
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
@zendeskgarden/container-selection
Advanced tools
Containers relating to selection in the Garden Design System
This package includes containers relating to selection in the Garden Design System.
npm install @zendeskgarden/container-selection
Check out storybook for live examples.
The useSelection
hook which manages an items focus state including keyboard controls,
aria attributes and RTL support. It uses the
roving tab index strategy.
import { useSelection } from '@zendeskgarden/container-selection';
const items = ['Item 1', 'Item 2', 'Item 3'];
const Selection = ({ direction }) => {
const { focusedItem, selectedItem, getContainerProps, getItemProps } = useSelection({
direction
});
return (
<ul {...getContainerProps()}>
{items.map(item => {
const ref = React.createRef();
const isSelected = selectedItem === item;
const isFocused = focusedItem === item;
return (
<li
{...getItemProps({
key: item,
item,
ref,
focusRef: ref
})}
>
{item}
{isSelected && <div>[Selected]</div>}
{isFocused && <div>(Focused)</div>}
</li>
);
})}
</ul>
);
};
import { SelectionContainer } from '@zendeskgarden/container-selection';
const items = ['Item 1', 'Item 2', 'Item 3'];
<SelectionContainer direction="vertical">
{({ selectedItem, focusedItem, getContainerProps, getItemProps }) => (
<ul {...getContainerProps()}>
{items.map(item => {
const ref = React.createRef();
const isSelected = item === selectedItem;
const isFocused = item === focusedItem;
return (
<li
{...getItemProps({
key: item,
item,
ref,
focusRef: ref
})}
>
{item}
{isSelected && <span> - Selected</span>}
{isFocused && <span> - Focused</span>}
</li>
);
})}
</ul>
)}
</SelectionContainer>;
FAQs
Containers relating to selection in the Garden Design System
The npm package @zendeskgarden/container-selection receives a total of 39,661 weekly downloads. As such, @zendeskgarden/container-selection popularity was classified as popular.
We found that @zendeskgarden/container-selection demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.